<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //  对象执行方法时，先查看自己是否有这个方法，没有则查看隐式原型
        //  就近原则

        function Star(name, age) {
            this.name = name
            this.age = age
            this.play = function () {
                console.log('chifan');
            }
        }

        Star.prototype.sing = function () {
            console.log('显示原型 唱歌');
        }

        Star.prototype.sing=function(){
            console.log('吃饭');
        }
        let eason = new Star('eason', 22)
        eason.sing();
    </script>
</body>

</html>